#!/usr/bin/env bash
#This is a wrapper for python file, serving as a symbol link's targets
#Usage:
#   ln -s shell-Python commandName
#when you run commandName, you should make sure commandName.pyc/commandName.py exist.
#commandName is a simple name of commandName.pyc/commandName.py

FileName=`basename $0`
FileDir=`dirname $0`

if [ "$FileDir" = "." ]; then	
	FileDir=`pwd`
fi

PytonProgram=$FileDir/$FileName.pyc

if [ ! -x $PytonProgram ]; then
	PytonProgram=$FileDir/$FileName.py

	if [ ! -x $PytonProgram ]; then
		$echo "$0 : Cannot find $PytonProgram"
		exit 1
	fi
fi

python $PytonProgram "$@"

rc=$?
exit $rc
